Little blkif interface and xend fixes to make parallax work again.
Also minor debug printing fix to blktap.
Signed-off-by: andrew.warfield@cl.cam.ac.uk
extern void blkif_ctrlif_rx(ctrl_msg_t *msg, unsigned long id);
/* debug */
-void print_vm_ring_idxs(void);
+void print_fe_ring_idxs(void);
+void print_be_ring_idxs(void);
#define __BLKINT_H__
#endif
if ( (blkif = kmem_cache_alloc(blkif_cachep, GFP_KERNEL)) == NULL )
{
- DPRINTK("Could not create blkif: out of memory\n");
+ WPRINTK("Could not create blkif: out of memory\n");
create->status = BLKIF_BE_STATUS_OUT_OF_MEMORY;
return;
}
{
if ( ((*pblkif)->domid == domid) && ((*pblkif)->handle == handle) )
{
- DPRINTK("Could not create blkif: already exists\n");
+ WPRINTK("Could not create blkif: already exists\n");
create->status = BLKIF_BE_STATUS_INTERFACE_EXISTS;
kmem_cache_free(blkif_cachep, blkif);
return;
blkif = blkif_find_by_handle(domid, handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("blkif_connect attempted for non-existent blkif (%u,%u)\n",
+ WPRINTK("blkif_connect attempted for non-existent blkif (%u,%u)\n",
connect->domid, connect->blkif_handle);
connect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return;
blkif = blkif_find_by_handle(domid, handle);
if ( unlikely(blkif == NULL) )
{
- DPRINTK("blkif_disconnect attempted for non-existent blkif"
+ WPRINTK("blkif_disconnect attempted for non-existent blkif"
" (%u,%u)\n", disconnect->domid, disconnect->blkif_handle);
disconnect->status = BLKIF_BE_STATUS_INTERFACE_NOT_FOUND;
return 1; /* Caller will send response error message. */
blktap_be_ring.sring = NULL;
}
+
+
+
+/* Debug : print the current ring indices. */
+
+void print_fe_ring_idxs(void)
+{
+ int i;
+ blkif_t *blkif;
+
+ WPRINTK("FE Rings: \n---------\n");
+ for ( i = 0; i < BLKIF_HASHSZ; i++) {
+ blkif = blkif_hash[i];
+ while (blkif != NULL) {
+ if (blkif->status == DISCONNECTED) {
+ WPRINTK("(%2d,%2d) DISCONNECTED\n",
+ blkif->domid, blkif->handle);
+ } else if (blkif->status == DISCONNECTING) {
+ WPRINTK("(%2d,%2d) DISCONNECTING\n",
+ blkif->domid, blkif->handle);
+ } else if (blkif->blk_ring.sring == NULL) {
+ WPRINTK("(%2d,%2d) CONNECTED, but null sring!\n",
+ blkif->domid, blkif->handle);
+ } else {
+ blkif_get(blkif);
+ WPRINTK("(%2d,%2d): req_cons: %2d, rsp_prod_prv: %2d "
+ "| req_prod: %2d, rsp_prod: %2d\n",
+ blkif->domid, blkif->handle,
+ blkif->blk_ring.req_cons,
+ blkif->blk_ring.rsp_prod_pvt,
+ blkif->blk_ring.sring->req_prod,
+ blkif->blk_ring.sring->rsp_prod);
+ blkif_put(blkif);
+ }
+ blkif = blkif->hash_next;
+ }
+ }
+}
/* Debug : print the current ring indices. */
-void print_vm_ring_idxs(void)
+void print_be_ring_idxs(void)
{
- int i;
- blkif_t *blkif;
-
- WPRINTK("FE Rings: \n---------\n");
- for ( i = 0; i < 50; i++) {
- blkif = blkif_find_by_handle((domid_t)i, 0);
- if (blkif != NULL) {
- if (blkif->blk_ring.sring != NULL) {
- WPRINTK("%2d: req_cons: %2d, rsp_prod_prv: %2d "
- "| req_prod: %2d, rsp_prod: %2d\n", i,
- blkif->blk_ring.req_cons,
- blkif->blk_ring.rsp_prod_pvt,
- blkif->blk_ring.sring->req_prod,
- blkif->blk_ring.sring->rsp_prod);
- } else {
- WPRINTK("%2d: [no device channel yet]\n", i);
- }
- }
- }
if (blktap_be_ring.sring != NULL) {
WPRINTK("BE Ring: \n--------\n");
WPRINTK("BE: rsp_cons: %2d, req_prod_prv: %2d "
}
case BLKTAP_IOCTL_PRINT_IDXS:
{
- print_vm_ring_idxs();
+ print_be_ring_idxs();
+ print_fe_ring_idxs();
WPRINTK("User Rings: \n-----------\n");
WPRINTK("UF: rsp_cons: %2d, req_prod_prv: %2d "
"| req_prod: %2d, rsp_prod: %2d\n",
C2P(blkif_be_vbd_create_t, domid, Int, Long);
C2P(blkif_be_vbd_create_t, blkif_handle, Int, Long);
C2P(blkif_be_vbd_create_t, pdevice, Int, Long);
+ C2P(blkif_be_vbd_create_t, dev_handle, Int, Long);
C2P(blkif_be_vbd_create_t, vdevice, Int, Long);
C2P(blkif_be_vbd_create_t, readonly, Int, Long);
C2P(blkif_be_vbd_create_t, status, Int, Long);
P2C(blkif_be_vbd_create_t, domid, u32);
P2C(blkif_be_vbd_create_t, blkif_handle, u32);
P2C(blkif_be_vbd_create_t, pdevice, blkif_pdev_t);
+ P2C(blkif_be_vbd_create_t, dev_handle, u32);
P2C(blkif_be_vbd_create_t, vdevice, blkif_vdev_t);
P2C(blkif_be_vbd_create_t, readonly, u16);
break;
raise ValueError('Invalid operation:' + op)
# Special case phy devices - they don't require any (un)binding
- if type == 'phy':
+ # Parallax also doesn't need script-based binding.
+ if (type == 'phy') or (type == 'parallax'):
return dets
if script is None:
self.params = None
self.node = None
self.device = None
+ self.dev_handle = 0
self.start_sector = None
self.nr_sectors = None
# NOTE:
# This clause is testing code for storage system experiments.
# Add a new disk type that will just pass an opaque id in the
- # start_sector and use an experimental device type.
+ # dev_handle and use an experimental device type.
# Please contact andrew.warfield@cl.cam.ac.uk with any concerns.
if self.type == 'parallax':
self.node = node
self.device = 61440 # (240,0)
- self.start_sector = long(self.params)
+ self.dev_handle = long(self.params)
self.nr_sectors = long(0)
return
# done.
{ 'domid' : self.frontendDomain,
'blkif_handle' : self.backendId,
'pdevice' : self.device,
+ 'dev_handle' : self.dev_handle,
'vdevice' : self.vdev,
'readonly' : self.readonly() })
msg = self.backendChannel.requestResponse(msg)
u16 __pad;
u32 blkif_handle; /* 4: ...ditto... */
blkif_pdev_t pdevice; /* 8 */
- blkif_vdev_t vdevice; /* 12: Interface-specific id for this VBD. */
- u16 readonly; /* 14: Non-zero -> VBD isn't writable. */
+ u32 dev_handle; /* 12: Extended device id field. */
+ blkif_vdev_t vdevice; /* 16: Interface-specific id for this VBD. */
+ u16 readonly; /* 18: Non-zero -> VBD isn't writable. */
/* OUT */
- u32 status; /* 16 */
-} PACKED blkif_be_vbd_create_t; /* 20 bytes */
+ u32 status; /* 20 */
+} PACKED blkif_be_vbd_create_t; /* 24 bytes */
/* CMSG_BLKIF_BE_VBD_DESTROY */
typedef struct {